package test.spider;

import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import billing.spider.SpiderUtils;
import billing.spider.bean.BaseSpider;
import billing.system.logger.SysLog;
import billing.system.utils.JSONUtils;

public class A {
	public static void main(String[] args) {
		SysLog.initialize();
		//aa();
		//bb();
		cc();
	}

	 static void cc() {
		 SpiderUtils.start(new SpiderUtils(){
			@Override
			public void callBack(List<BaseSpider> spiderLst) {
				for (BaseSpider baseSpider : spiderLst) {
					System.out.println(JSONUtils.toJson(baseSpider));
				}
			}
		 },new Hao123());
	}

	static void aa() {
			Map<String,List<BaseSpider>> spiders = SpiderUtils.start(new DemoSpider());
			for (Entry<String, List<BaseSpider>> entry : spiders.entrySet()) {
				System.out.println("key ["+entry.getKey()+"] ====??");
				for (BaseSpider baseSpider : entry.getValue()) {
					System.out.println(JSONUtils.toJson(baseSpider));
					//System.out.println(baseSpider.toString());
				}
			}
	}
	 
	 static void bb() {
			Map<String,List<BaseSpider>> spiders = SpiderUtils.start(new Hao123());
			for (Entry<String, List<BaseSpider>> entry : spiders.entrySet()) {
				System.out.println("key ["+entry.getKey()+"] ==== >> ");
				for (BaseSpider baseSpider : entry.getValue()) {
					System.out.println(JSONUtils.toJson(baseSpider));
					//System.out.println(baseSpider.toString());
				}
			}
	}
}
